#pragma once

#include "Color.h"
#include <GL/glew.h>

namespace cagd
{
    class Material
    {
    protected:
        Color   _front_ambient, _front_diffuse, _front_specular, _front_emmisive;
        GLfloat _front_shininess;

        Color   _back_ambient, _back_diffuse, _back_specular, _back_emmisive;
        GLfloat _back_shininess;

    public:
        Material(const Color& front_ambient     = Color(),
                 const Color& front_diffuse     = Color(),
                 const Color& front_specular    = Color(),
                 const Color& front_emissive    = Color(),
                 GLfloat front_shininess        = 128.0,
                 const Color& back_ambient      = Color(),
                 const Color& back_diffuse      = Color(),
                 const Color& back_specular     = Color(),
                 const Color& back_emissive     = Color(),
                 GLfloat back_shininess         = 128.0);

        GLvoid SetAmbientColor(GLenum face, const Color& c);
        GLvoid SetAmbientColor(GLenum face, GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);

        GLvoid SetDiffuseColor(GLenum face, const Color& c);
        GLvoid SetDiffuseColor(GLenum face, GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);

        GLvoid SetEmissiveColor(GLenum face, const Color& c);
        GLvoid SetEmissiveColor(GLenum face, GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);

        GLvoid SetSpecularColor(GLenum face, const Color& c);
        GLvoid SetSpecularColor(GLenum face, GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.0f);

        GLvoid SetShininess(GLenum mface, GLfloat shininess);

        GLvoid SetTransparency(GLfloat alpha);

        GLvoid Apply();

        GLboolean IsTransparent() const;
    };

    extern
    Material    MatFBBrass,
                MatFBGold,
                MatFBSilver,
                MatFBEmerald,
                MatFBPearl,
                MatFBRuby,
                MatFBTurquoise;
}
